﻿// ----------------------------------------------------------------
// Description : 实体类,该文件由MyGeneration生成
// Author      : 
// Create date : 2009-12-05
// ----------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using Microsoft.Practices.EnterpriseLibrary.Data;

namespace ITOMMS.Entity
{
	/// <summary>
	///	tbCustEmployeeInfo Entity
	///	tbCustEmployeeInfo Entity客户公司的员工信息表
	/// </summary>
	[Serializable]
	public class tbCustEmployeeInfoEntity : BaseEntity<tbCustEmployeeInfoEntity,int>
	{
		
		#region 私有成员			
		
		private int _ID; 
		private int? _CompanyID; 
		private string _RealName; 
		private string _Nickname; 
		private string _sex; 
		private string _DepartmentID; 
		private string _job; 
		private int? _State; 
		private string _EmployeeNo; 
		private string _Email; 
		private string _Tel; 
		private string _Moblile; 
		private string _MSN; 
		private string _QQ; 
		private string _PCUserName; 
		private string _PCPWD; 
		private string _PCName; 
		private string _WorkGroup; 
		private string _EmailName; 
		private string _EmailPWD; 
		private string _BIOSPWD; 
		private string _WebPWD; 
		private string _IPAddr; 
		private string _SubnetMask; 
		private string _DefaultGateway; 
		private string _DNS1; 
		private string _DNS2; 
		private string _MACAddr; 
		private bool? _WebNetIsOpen; 
		private bool? _USBIsOpen; 
		private bool? _QQIsOpen; 
		private bool? _MsnIsOpen; 
		private string _Remark; 
		private DateTime? _CreateDate; 
		private int? _CreateBy; 
		private DateTime? _ModifyDate; 
		private int? _ModifyBy; 
		private int _SEQNO;
		#endregion


		
		#region 默认( 空 ) 构造函数
		/// <summary>
		/// 默认构造函数
		/// </summary>
		public tbCustEmployeeInfoEntity()
		{
			_ID = 0; 
			_CompanyID =  null; 
			_RealName = String.Empty; 
			_Nickname = String.Empty; 
			_sex = String.Empty; 
			_DepartmentID = String.Empty; 
			_job = String.Empty; 
			_State =  null; 
			_EmployeeNo = String.Empty; 
			_Email = String.Empty; 
			_Tel = String.Empty; 
			_Moblile = String.Empty; 
			_MSN = String.Empty; 
			_QQ = String.Empty; 
			_PCUserName = String.Empty; 
			_PCPWD = String.Empty; 
			_PCName = String.Empty; 
			_WorkGroup = String.Empty; 
			_EmailName = String.Empty; 
			_EmailPWD = String.Empty; 
			_BIOSPWD = String.Empty; 
			_WebPWD = String.Empty; 
			_IPAddr = String.Empty; 
			_SubnetMask = String.Empty; 
			_DefaultGateway = String.Empty; 
			_DNS1 = String.Empty; 
			_DNS2 = String.Empty; 
			_MACAddr = String.Empty; 
			_WebNetIsOpen =  null; 
			_USBIsOpen =  null; 
			_QQIsOpen =  null; 
			_MsnIsOpen =  null; 
			_Remark = String.Empty; 
			_CreateDate =  null; 
			_CreateBy =  null; 
			_ModifyDate =  null; 
			_ModifyBy =  null; 
			_SEQNO = 0;
		}
		#endregion
		
		#region 属性值校验
		
		/// <summary>
		/// 属性值校验
		/// </summary>
		public bool CheckValues()
		{
			bool bResult = true;
			string strError = "";
		
			if ( _ID ==  0)
			{
				bResult = false;
				strError += "\r\n 非空值不能为: "+_ID;
			}
			
			if( !bResult )
					throw new ArgumentOutOfRangeException(strError);
			return bResult;
			
		}
		
		#endregion
		
		
		
	
		#region Required Fields Only Constructor
		
		/// <summary>
		/// required (not null) fields only constructor
		/// </summary>
		public tbCustEmployeeInfoEntity(
		int para_ID		)
		: this()
		{
					_ID = para_ID;
			_CompanyID = null;
			_RealName = String.Empty;
			_Nickname = String.Empty;
			_sex = String.Empty;
			_DepartmentID = String.Empty;
			_job = String.Empty;
			_State = null;
			_EmployeeNo = String.Empty;
			_Email = String.Empty;
			_Tel = String.Empty;
			_Moblile = String.Empty;
			_MSN = String.Empty;
			_QQ = String.Empty;
			_PCUserName = String.Empty;
			_PCPWD = String.Empty;
			_PCName = String.Empty;
			_WorkGroup = String.Empty;
			_EmailName = String.Empty;
			_EmailPWD = String.Empty;
			_BIOSPWD = String.Empty;
			_WebPWD = String.Empty;
			_IPAddr = String.Empty;
			_SubnetMask = String.Empty;
			_DefaultGateway = String.Empty;
			_DNS1 = String.Empty;
			_DNS2 = String.Empty;
			_MACAddr = String.Empty;
			_WebNetIsOpen = null;
			_USBIsOpen = null;
			_QQIsOpen = null;
			_MsnIsOpen = null;
			_Remark = String.Empty;
			_CreateDate = null;
			_CreateBy = null;
			_ModifyDate = null;
			_ModifyBy = null;
		}
		#endregion 

		
		#region 公有属性
			
			/// <summary>
			/// 行号，顺序号。系统默认的属性
			/// </summary>
			public virtual int SEQNO
			{
				get { return _SEQNO; }
				set { _SEQNO = value; }
			}
		
			
		/// <summary>
		/// IDID
		/// </summary>		
		public virtual int ID
		{
			get { return _ID; }
			set { _ID = value; }
		}
			
		/// <summary>
		/// CompanyID所属公司
		/// </summary>		
		public virtual int? CompanyID
		{
			get { return _CompanyID; }
			set { _CompanyID = value; }
		}
			
		/// <summary>
		/// RealName姓名
		/// </summary>		
		public virtual string RealName
		{
			get { return _RealName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for RealName", value, value.ToString());
				
				_RealName = value;
			}
		}
			
		/// <summary>
		/// Nickname呢称
		/// </summary>		
		public virtual string Nickname
		{
			get { return _Nickname; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for Nickname", value, value.ToString());
				
				_Nickname = value;
			}
		}
			
		/// <summary>
		/// sex性别
		/// </summary>		
		public virtual string sex
		{
			get { return _sex; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 3)
						throw new ArgumentOutOfRangeException("Invalid value for sex", value, value.ToString());
				
				_sex = value;
			}
		}
			
		/// <summary>
		/// DepartmentID部门
		/// </summary>		
		public virtual string DepartmentID
		{
			get { return _DepartmentID; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for DepartmentID", value, value.ToString());
				
				_DepartmentID = value;
			}
		}
			
		/// <summary>
		/// job职位职称
		/// </summary>		
		public virtual string job
		{
			get { return _job; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for job", value, value.ToString());
				
				_job = value;
			}
		}
			
		/// <summary>
		/// State状态
		/// </summary>		
		public virtual int? State
		{
			get { return _State; }
			set { _State = value; }
		}
			
		/// <summary>
		/// EmployeeNo编号
		/// </summary>		
		public virtual string EmployeeNo
		{
			get { return _EmployeeNo; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for EmployeeNo", value, value.ToString());
				
				_EmployeeNo = value;
			}
		}
			
		/// <summary>
		/// Email邮箱
		/// </summary>		
		public virtual string Email
		{
			get { return _Email; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for Email", value, value.ToString());
				
				_Email = value;
			}
		}
			
		/// <summary>
		/// Tel电话
		/// </summary>		
		public virtual string Tel
		{
			get { return _Tel; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for Tel", value, value.ToString());
				
				_Tel = value;
			}
		}
			
		/// <summary>
		/// Moblile手机号
		/// </summary>		
		public virtual string Moblile
		{
			get { return _Moblile; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for Moblile", value, value.ToString());
				
				_Moblile = value;
			}
		}
			
		/// <summary>
		/// MSNMSN
		/// </summary>		
		public virtual string MSN
		{
			get { return _MSN; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for MSN", value, value.ToString());
				
				_MSN = value;
			}
		}
			
		/// <summary>
		/// QQQQ
		/// </summary>		
		public virtual string QQ
		{
			get { return _QQ; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for QQ", value, value.ToString());
				
				_QQ = value;
			}
		}
			
		/// <summary>
		/// PCUserName计算机用户名
		/// </summary>		
		public virtual string PCUserName
		{
			get { return _PCUserName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for PCUserName", value, value.ToString());
				
				_PCUserName = value;
			}
		}
			
		/// <summary>
		/// PCPWD计算机密码
		/// </summary>		
		public virtual string PCPWD
		{
			get { return _PCPWD; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for PCPWD", value, value.ToString());
				
				_PCPWD = value;
			}
		}
			
		/// <summary>
		/// PCName计算机名
		/// </summary>		
		public virtual string PCName
		{
			get { return _PCName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for PCName", value, value.ToString());
				
				_PCName = value;
			}
		}
			
		/// <summary>
		/// WorkGroup工作组域
		/// </summary>		
		public virtual string WorkGroup
		{
			get { return _WorkGroup; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for WorkGroup", value, value.ToString());
				
				_WorkGroup = value;
			}
		}
			
		/// <summary>
		/// EmailName邮箱名
		/// </summary>		
		public virtual string EmailName
		{
			get { return _EmailName; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for EmailName", value, value.ToString());
				
				_EmailName = value;
			}
		}
			
		/// <summary>
		/// EmailPWD邮箱密码
		/// </summary>		
		public virtual string EmailPWD
		{
			get { return _EmailPWD; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 50)
						throw new ArgumentOutOfRangeException("Invalid value for EmailPWD", value, value.ToString());
				
				_EmailPWD = value;
			}
		}
			
		/// <summary>
		/// BIOSPWDBIOS密码
		/// </summary>		
		public virtual string BIOSPWD
		{
			get { return _BIOSPWD; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for BIOSPWD", value, value.ToString());
				
				_BIOSPWD = value;
			}
		}
			
		/// <summary>
		/// WebPWDWeb密码
		/// </summary>		
		public virtual string WebPWD
		{
			get { return _WebPWD; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for WebPWD", value, value.ToString());
				
				_WebPWD = value;
			}
		}
			
		/// <summary>
		/// IPAddrIP地址
		/// </summary>		
		public virtual string IPAddr
		{
			get { return _IPAddr; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for IPAddr", value, value.ToString());
				
				_IPAddr = value;
			}
		}
			
		/// <summary>
		/// SubnetMask子网掩码
		/// </summary>		
		public virtual string SubnetMask
		{
			get { return _SubnetMask; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for SubnetMask", value, value.ToString());
				
				_SubnetMask = value;
			}
		}
			
		/// <summary>
		/// DefaultGateway默认网关
		/// </summary>		
		public virtual string DefaultGateway
		{
			get { return _DefaultGateway; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for DefaultGateway", value, value.ToString());
				
				_DefaultGateway = value;
			}
		}
			
		/// <summary>
		/// DNS1DNS1
		/// </summary>		
		public virtual string DNS1
		{
			get { return _DNS1; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for DNS1", value, value.ToString());
				
				_DNS1 = value;
			}
		}
			
		/// <summary>
		/// DNS2DNS2
		/// </summary>		
		public virtual string DNS2
		{
			get { return _DNS2; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 20)
						throw new ArgumentOutOfRangeException("Invalid value for DNS2", value, value.ToString());
				
				_DNS2 = value;
			}
		}
			
		/// <summary>
		/// MACAddrMAC地址
		/// </summary>		
		public virtual string MACAddr
		{
			get { return _MACAddr; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 30)
						throw new ArgumentOutOfRangeException("Invalid value for MACAddr", value, value.ToString());
				
				_MACAddr = value;
			}
		}
			
		/// <summary>
		/// WebNetIsOpenWeb上网
		/// </summary>		
		public virtual bool? WebNetIsOpen
		{
			get { return _WebNetIsOpen; }
			set { _WebNetIsOpen = value; }
		}
			
		/// <summary>
		/// USBIsOpenUSB端口
		/// </summary>		
		public virtual bool? USBIsOpen
		{
			get { return _USBIsOpen; }
			set { _USBIsOpen = value; }
		}
			
		/// <summary>
		/// QQIsOpenQQ是否开启
		/// </summary>		
		public virtual bool? QQIsOpen
		{
			get { return _QQIsOpen; }
			set { _QQIsOpen = value; }
		}
			
		/// <summary>
		/// MsnIsOpenMSN是否开户
		/// </summary>		
		public virtual bool? MsnIsOpen
		{
			get { return _MsnIsOpen; }
			set { _MsnIsOpen = value; }
		}
			
		/// <summary>
		/// Remark备注
		/// </summary>		
		public virtual string Remark
		{
			get { return _Remark; }
			set	
			{
				
				if ( value != null)
					if( value.Length > 200)
						throw new ArgumentOutOfRangeException("Invalid value for Remark", value, value.ToString());
				
				_Remark = value;
			}
		}
			
		/// <summary>
		/// CreateDate创建时间
		/// </summary>		
		public virtual DateTime? CreateDate
		{
			get { return _CreateDate; }
			set { _CreateDate = value; }
		}
			
		/// <summary>
		/// CreateBy创建人
		/// </summary>		
		public virtual int? CreateBy
		{
			get { return _CreateBy; }
			set { _CreateBy = value; }
		}
			
		/// <summary>
		/// ModifyDate修改时间
		/// </summary>		
		public virtual DateTime? ModifyDate
		{
			get { return _ModifyDate; }
			set { _ModifyDate = value; }
		}
			
		/// <summary>
		/// ModifyBy修改人
		/// </summary>		
		public virtual int? ModifyBy
		{
			get { return _ModifyBy; }
			set { _ModifyBy = value; }
		}
			


		#endregion 	
		
		
        #region DAO操作
		
		
		/// <summary>
        /// 获取所有实体的列表
        /// </summary>
        /// <returns></returns>
        public override List<tbCustEmployeeInfoEntity> GetAll()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_CustEmployeeInfo] ");
	
            List<tbCustEmployeeInfoEntity> list = new List<tbCustEmployeeInfoEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = 0;
                while (dataReader.Read())
                {	seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords()
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([ID])  from [tb_CustEmployeeInfo] ");
	
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }
		
		/// <summary>
        /// 获取所有实体的列表总行数
        /// </summary>
        /// <returns></returns>
        public override int GetTotalRecords(string sqlCondition)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("  select count([ID])  from [tb_CustEmployeeInfo]  ");
	
			 if (sqlCondition.Trim() != "")
            {
                strSql.Append(" where " + sqlCondition);
            }
            Database db = GetDatabase();
            return (int)db.ExecuteScalar(CommandType.Text, strSql.ToString());
        }	
		
		
		/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
        /// <returns></returns>
		 public override List<tbCustEmployeeInfoEntity> GetAllByQuery(string strWhere, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_CustEmployeeInfo] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [ID] from [tb_CustEmployeeInfo] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere );
            }
			strSql.Append(" ) " );

            List<tbCustEmployeeInfoEntity> list = new List<tbCustEmployeeInfoEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
			   int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
			/// <summary>
        /// 按条件查询,得到一页的对应的结果列表
        /// </summary>
        /// <param name="strWhere">条件</param>
		/// <param name="PageSize">每页大小</param>
		/// <param name="CurrentPageIndex">当前页码</param>
		/// <param name="strSort">ex:order by id desc</param>
        /// <returns></returns>
		 public override List<tbCustEmployeeInfoEntity> GetAllByQuery(string strWhere,string strSort, int PageSize, int CurrentPageIndex)
        {
            StringBuilder strSql = new StringBuilder();
            if (strWhere.Contains("order".ToLower()))
            {
                throw new Exception("分页查询的sql条件中不能包括排序子句，请调用重载方法实现有条件的排序筛选");
            }
		 
			strSql.Append("select top ").Append(PageSize).Append("  [ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_CustEmployeeInfo] where ");

			 if (strWhere.Trim() != "")
            {
                strSql.Append("  " + strWhere + " and ");
            }
			  strSql.Append(" ID not in ( ");
			 strSql.Append(" select top ").Append(PageSize*(CurrentPageIndex-1)).Append("  [ID] from [tb_CustEmployeeInfo] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere+" " ).Append(strSort);
            }
			strSql.Append(" ) " ).Append(strSort);

            List<tbCustEmployeeInfoEntity> list = new List<tbCustEmployeeInfoEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq = PageSize * (CurrentPageIndex - 1);
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader, seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        public override List<tbCustEmployeeInfoEntity> GetAllByQuery(string strWhere)
        {
			strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from tb_CustEmployeeInfo ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tbCustEmployeeInfoEntity> list = new List<tbCustEmployeeInfoEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            { 
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		/// <summary>
        /// 按条件查询,得到对应的结果列表
        /// </summary>
        /// <param name="strWhere"></param>
		/// <param name="parameters">sql条件中的参数</param>
        /// <returns></returns>
        public override List<tbCustEmployeeInfoEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_CustEmployeeInfo] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tbCustEmployeeInfoEntity> list = new List<tbCustEmployeeInfoEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
				int seq =0 ;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		

		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<tbCustEmployeeInfoEntity> GetAllByQuery(string strWhere, List<IDataParameter> parameters, int rowNumber)
        {

            StringBuilder strSql = new StringBuilder();
			strSql.Append("select top ").Append(rowNumber).Append("  [ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_CustEmployeeInfo] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<tbCustEmployeeInfoEntity> list = new List<tbCustEmployeeInfoEntity>();
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            foreach (IDataParameter sp in parameters)
            {
                db.AddInParameter(dbCommand, sp.ParameterName, sp.DbType, sp.Value);
            }

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {	
				int seq = 0;
                while (dataReader.Read())
                {
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		/// <summary>
        /// 获取按条件查询以后的结果列表的前指定rowNumber行记录
        /// </summary>
        /// <param name="strWhere">不带where关键字的SQL条件语句: AND AA=@AA</param>
        /// <param name="rowNumber"></param>
        /// <returns></returns>
        public override List<tbCustEmployeeInfoEntity> GetAllByQuery(string strWhere, int rowNumber)
        {
		    strWhere = SQLInjectionFilter(strWhere);
            StringBuilder strSql = new StringBuilder();
			
			strSql.Append("select top ").Append(rowNumber).Append("  [ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_CustEmployeeInfo] ");

            if (strWhere.Trim() != "")
            {
                strSql.Append(" where  " + strWhere);
            }
            List<tbCustEmployeeInfoEntity> list = new List<tbCustEmployeeInfoEntity>();
            Database db = GetDatabase();
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
				int seq=0;
                while (dataReader.Read())
                {	
					seq++;
                    list.Add(ReaderBind(dataReader,seq));
                }
            }
            return list;
        }
		
		
		
		
		
		
		
        /// <summary>
        /// 按主键查询对应的实体
        /// </summary>
        /// <param name="id">主键ID</param>
        /// <returns></returns>
        public override tbCustEmployeeInfoEntity GetById(int id)
        {
            StringBuilder strSql = new StringBuilder();
			strSql.Append("select [ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] from [tb_CustEmployeeInfo]  where ID= @ID ");
				
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, id);
            tbCustEmployeeInfoEntity entity = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    entity = ReaderBind(dataReader);
                }
            }
            return entity;

        }
		
		
		 /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save()
        {
			
            if (this.ID ==0)
            {
                this.ID = GetMax("tb_CustEmployeeInfo");
            }
            StringBuilder strSql = new StringBuilder();
			strSql.Append("insert into  tb_CustEmployeeInfo (");
			strSql.Append("[ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] )");
			strSql.Append(" values (");
			strSql.Append("@ID,@CompanyID,@RealName,@Nickname,@sex,@DepartmentID,@job,@State,@EmployeeNo,@Email,@Tel,@Moblile,@MSN,@QQ,@PCUserName,@PCPWD,@PCName,@WorkGroup,@EmailName,@EmailPWD,@BIOSPWD,@WebPWD,@IPAddr,@SubnetMask,@DefaultGateway,@DNS1,@DNS2,@MACAddr,@WebNetIsOpen,@USBIsOpen,@QQIsOpen,@MsnIsOpen,@Remark,@CreateDate,@CreateBy,@ModifyDate,@ModifyBy)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, this.ID);
			if (this.CompanyID == null)
			{
			db.AddInParameter(dbCommand, "CompanyID", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CompanyID", DbType.Int32, this.CompanyID.Value);
			}
			db.AddInParameter(dbCommand, "RealName", DbType.String, this.RealName);
			db.AddInParameter(dbCommand, "Nickname", DbType.String, this.Nickname);
			db.AddInParameter(dbCommand, "sex", DbType.String, this.sex);
			db.AddInParameter(dbCommand, "DepartmentID", DbType.String, this.DepartmentID);
			db.AddInParameter(dbCommand, "job", DbType.String, this.job);
			if (this.State == null)
			{
			db.AddInParameter(dbCommand, "State", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "State", DbType.Int32, this.State.Value);
			}
			db.AddInParameter(dbCommand, "EmployeeNo", DbType.String, this.EmployeeNo);
			db.AddInParameter(dbCommand, "Email", DbType.String, this.Email);
			db.AddInParameter(dbCommand, "Tel", DbType.String, this.Tel);
			db.AddInParameter(dbCommand, "Moblile", DbType.String, this.Moblile);
			db.AddInParameter(dbCommand, "MSN", DbType.String, this.MSN);
			db.AddInParameter(dbCommand, "QQ", DbType.String, this.QQ);
			db.AddInParameter(dbCommand, "PCUserName", DbType.String, this.PCUserName);
			db.AddInParameter(dbCommand, "PCPWD", DbType.String, this.PCPWD);
			db.AddInParameter(dbCommand, "PCName", DbType.String, this.PCName);
			db.AddInParameter(dbCommand, "WorkGroup", DbType.String, this.WorkGroup);
			db.AddInParameter(dbCommand, "EmailName", DbType.String, this.EmailName);
			db.AddInParameter(dbCommand, "EmailPWD", DbType.String, this.EmailPWD);
			db.AddInParameter(dbCommand, "BIOSPWD", DbType.String, this.BIOSPWD);
			db.AddInParameter(dbCommand, "WebPWD", DbType.String, this.WebPWD);
			db.AddInParameter(dbCommand, "IPAddr", DbType.String, this.IPAddr);
			db.AddInParameter(dbCommand, "SubnetMask", DbType.String, this.SubnetMask);
			db.AddInParameter(dbCommand, "DefaultGateway", DbType.String, this.DefaultGateway);
			db.AddInParameter(dbCommand, "DNS1", DbType.String, this.DNS1);
			db.AddInParameter(dbCommand, "DNS2", DbType.String, this.DNS2);
			db.AddInParameter(dbCommand, "MACAddr", DbType.String, this.MACAddr);
			if (this.WebNetIsOpen == null)
			{
			db.AddInParameter(dbCommand, "WebNetIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "WebNetIsOpen", DbType.Decimal, this.WebNetIsOpen.Value);
			}
			if (this.USBIsOpen == null)
			{
			db.AddInParameter(dbCommand, "USBIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "USBIsOpen", DbType.Decimal, this.USBIsOpen.Value);
			}
			if (this.QQIsOpen == null)
			{
			db.AddInParameter(dbCommand, "QQIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "QQIsOpen", DbType.Decimal, this.QQIsOpen.Value);
			}
			if (this.MsnIsOpen == null)
			{
			db.AddInParameter(dbCommand, "MsnIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "MsnIsOpen", DbType.Decimal, this.MsnIsOpen.Value);
			}
			db.AddInParameter(dbCommand, "Remark", DbType.String, this.Remark);
			if (this.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
			}
			if (this.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, this.CreateBy.Value);
			}
			if (this.ModifyDate == null)
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, this.ModifyDate.Value);
			}
			if (this.ModifyBy == null)
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, this.ModifyBy.Value);
			}

			return db.ExecuteNonQuery(dbCommand);
		  
      
        }
		

		
        /// <summary>
        /// 保存实体
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public override int Save(tbCustEmployeeInfoEntity entity)
        {
			
            if (entity.ID == 0)
            {
                entity.ID = GetMax("tb_CustEmployeeInfo");
            }
            StringBuilder strSql = new StringBuilder();
			strSql.Append("insert into  tb_CustEmployeeInfo (");
			strSql.Append("[ID],[CompanyID],[RealName],[Nickname],[sex],[DepartmentID],[job],[State],[EmployeeNo],[Email],[Tel],[Moblile],[MSN],[QQ],[PCUserName],[PCPWD],[PCName],[WorkGroup],[EmailName],[EmailPWD],[BIOSPWD],[WebPWD],[IPAddr],[SubnetMask],[DefaultGateway],[DNS1],[DNS2],[MACAddr],[WebNetIsOpen],[USBIsOpen],[QQIsOpen],[MsnIsOpen],[Remark],[CreateDate],[CreateBy],[ModifyDate],[ModifyBy] )");
			strSql.Append(" values (");
			strSql.Append("@ID,@CompanyID,@RealName,@Nickname,@sex,@DepartmentID,@job,@State,@EmployeeNo,@Email,@Tel,@Moblile,@MSN,@QQ,@PCUserName,@PCPWD,@PCName,@WorkGroup,@EmailName,@EmailPWD,@BIOSPWD,@WebPWD,@IPAddr,@SubnetMask,@DefaultGateway,@DNS1,@DNS2,@MACAddr,@WebNetIsOpen,@USBIsOpen,@QQIsOpen,@MsnIsOpen,@Remark,@CreateDate,@CreateBy,@ModifyDate,@ModifyBy)");

            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID);
			if (entity.CompanyID == null)
			{
			db.AddInParameter(dbCommand, "CompanyID", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CompanyID", DbType.Int32, entity.CompanyID.Value);
			}
			db.AddInParameter(dbCommand, "RealName", DbType.String, entity.RealName);
			db.AddInParameter(dbCommand, "Nickname", DbType.String, entity.Nickname);
			db.AddInParameter(dbCommand, "sex", DbType.String, entity.sex);
			db.AddInParameter(dbCommand, "DepartmentID", DbType.String, entity.DepartmentID);
			db.AddInParameter(dbCommand, "job", DbType.String, entity.job);
			if (entity.State == null)
			{
			db.AddInParameter(dbCommand, "State", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "State", DbType.Int32, entity.State.Value);
			}
			db.AddInParameter(dbCommand, "EmployeeNo", DbType.String, entity.EmployeeNo);
			db.AddInParameter(dbCommand, "Email", DbType.String, entity.Email);
			db.AddInParameter(dbCommand, "Tel", DbType.String, entity.Tel);
			db.AddInParameter(dbCommand, "Moblile", DbType.String, entity.Moblile);
			db.AddInParameter(dbCommand, "MSN", DbType.String, entity.MSN);
			db.AddInParameter(dbCommand, "QQ", DbType.String, entity.QQ);
			db.AddInParameter(dbCommand, "PCUserName", DbType.String, entity.PCUserName);
			db.AddInParameter(dbCommand, "PCPWD", DbType.String, entity.PCPWD);
			db.AddInParameter(dbCommand, "PCName", DbType.String, entity.PCName);
			db.AddInParameter(dbCommand, "WorkGroup", DbType.String, entity.WorkGroup);
			db.AddInParameter(dbCommand, "EmailName", DbType.String, entity.EmailName);
			db.AddInParameter(dbCommand, "EmailPWD", DbType.String, entity.EmailPWD);
			db.AddInParameter(dbCommand, "BIOSPWD", DbType.String, entity.BIOSPWD);
			db.AddInParameter(dbCommand, "WebPWD", DbType.String, entity.WebPWD);
			db.AddInParameter(dbCommand, "IPAddr", DbType.String, entity.IPAddr);
			db.AddInParameter(dbCommand, "SubnetMask", DbType.String, entity.SubnetMask);
			db.AddInParameter(dbCommand, "DefaultGateway", DbType.String, entity.DefaultGateway);
			db.AddInParameter(dbCommand, "DNS1", DbType.String, entity.DNS1);
			db.AddInParameter(dbCommand, "DNS2", DbType.String, entity.DNS2);
			db.AddInParameter(dbCommand, "MACAddr", DbType.String, entity.MACAddr);
			if (entity.WebNetIsOpen == null)
			{
			db.AddInParameter(dbCommand, "WebNetIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "WebNetIsOpen", DbType.Decimal, entity.WebNetIsOpen.Value);
			}
			if (entity.USBIsOpen == null)
			{
			db.AddInParameter(dbCommand, "USBIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "USBIsOpen", DbType.Decimal, entity.USBIsOpen.Value);
			}
			if (entity.QQIsOpen == null)
			{
			db.AddInParameter(dbCommand, "QQIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "QQIsOpen", DbType.Decimal, entity.QQIsOpen.Value);
			}
			if (entity.MsnIsOpen == null)
			{
			db.AddInParameter(dbCommand, "MsnIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "MsnIsOpen", DbType.Decimal, entity.MsnIsOpen.Value);
			}
			db.AddInParameter(dbCommand, "Remark", DbType.String, entity.Remark);
			if (entity.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
			}
			if (entity.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, entity.CreateBy.Value);
			}
			if (entity.ModifyDate == null)
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, entity.ModifyDate.Value);
			}
			if (entity.ModifyBy == null)
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, entity.ModifyBy.Value);
			}

			return db.ExecuteNonQuery(dbCommand);
		  
      
        }
		
		
        /// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate(tbCustEmployeeInfoEntity entity)
        {
			
            if (entity.ID  == 0)
            {
                if (Save(entity)>0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update(entity);
            }
        }
		
		/// <summary>
        /// 保存或者更新(如果传入的实体主键为空则保存,否则做更新操作)
        /// </summary>
        /// <param name="entity">传入的实体</param>
        /// <returns>影响的行数</returns>
        public override int SaveOrUpdate()
        {
		
            if (this.ID  == 0)
            {
                if (Save()>0)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
            else
            {
                return Update();
            }
        }
		
		/// <summary>
        /// 是否存在对应主键ID的记录
        /// </summary>
        /// <param name="ID"></param>
        /// <returns></returns>
        public override bool IsExist(int ID)
        {
            Database db = GetDatabase();
            StringBuilder strSql = new StringBuilder();
            			 strSql.Append("select count(1) from tb_CustEmployeeInfo where ID=@ID ");

            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, ID);//这里为ID是因为原有代码把主键都变成了ID.
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }
		
		
		/// <summary>
        /// 删除对应的实体
        /// </summary>
        /// <param name="entity"></param>
        public override int Delete(tbCustEmployeeInfoEntity entity)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete tb_CustEmployeeInfo ");
            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID );
            return db.ExecuteNonQuery(dbCommand);
        }
		
		/// <summary>
        /// 删除主键ID对应的记录
        /// </summary>
        /// <param name="id"></param>
        public override int Delete(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete tb_CustEmployeeInfo ");
            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "ID", DbType.Int32, id);
            return db.ExecuteNonQuery(dbCommand);
        }
		
		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public override int Update()
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update tb_CustEmployeeInfo set ");
			strSql.Append("[ID]=@ID,[CompanyID]=@CompanyID,[RealName]=@RealName,[Nickname]=@Nickname,[sex]=@sex,[DepartmentID]=@DepartmentID,[job]=@job,[State]=@State,[EmployeeNo]=@EmployeeNo,[Email]=@Email,[Tel]=@Tel,[Moblile]=@Moblile,[MSN]=@MSN,[QQ]=@QQ,[PCUserName]=@PCUserName,[PCPWD]=@PCPWD,[PCName]=@PCName,[WorkGroup]=@WorkGroup,[EmailName]=@EmailName,[EmailPWD]=@EmailPWD,[BIOSPWD]=@BIOSPWD,[WebPWD]=@WebPWD,[IPAddr]=@IPAddr,[SubnetMask]=@SubnetMask,[DefaultGateway]=@DefaultGateway,[DNS1]=@DNS1,[DNS2]=@DNS2,[MACAddr]=@MACAddr,[WebNetIsOpen]=@WebNetIsOpen,[USBIsOpen]=@USBIsOpen,[QQIsOpen]=@QQIsOpen,[MsnIsOpen]=@MsnIsOpen,[Remark]=@Remark,[CreateDate]=@CreateDate,[CreateBy]=@CreateBy,[ModifyDate]=@ModifyDate,[ModifyBy]=@ModifyBy ");

            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, this.ID );
			if (this.CompanyID == null)
			{
			db.AddInParameter(dbCommand, "CompanyID", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CompanyID", DbType.Int32, this.CompanyID.Value);
			}
			db.AddInParameter(dbCommand, "RealName", DbType.String, this.RealName);
			db.AddInParameter(dbCommand, "Nickname", DbType.String, this.Nickname);
			db.AddInParameter(dbCommand, "sex", DbType.String, this.sex);
			db.AddInParameter(dbCommand, "DepartmentID", DbType.String, this.DepartmentID);
			db.AddInParameter(dbCommand, "job", DbType.String, this.job);
			if (this.State == null)
			{
			db.AddInParameter(dbCommand, "State", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "State", DbType.Int32, this.State.Value);
			}
			db.AddInParameter(dbCommand, "EmployeeNo", DbType.String, this.EmployeeNo);
			db.AddInParameter(dbCommand, "Email", DbType.String, this.Email);
			db.AddInParameter(dbCommand, "Tel", DbType.String, this.Tel);
			db.AddInParameter(dbCommand, "Moblile", DbType.String, this.Moblile);
			db.AddInParameter(dbCommand, "MSN", DbType.String, this.MSN);
			db.AddInParameter(dbCommand, "QQ", DbType.String, this.QQ);
			db.AddInParameter(dbCommand, "PCUserName", DbType.String, this.PCUserName);
			db.AddInParameter(dbCommand, "PCPWD", DbType.String, this.PCPWD);
			db.AddInParameter(dbCommand, "PCName", DbType.String, this.PCName);
			db.AddInParameter(dbCommand, "WorkGroup", DbType.String, this.WorkGroup);
			db.AddInParameter(dbCommand, "EmailName", DbType.String, this.EmailName);
			db.AddInParameter(dbCommand, "EmailPWD", DbType.String, this.EmailPWD);
			db.AddInParameter(dbCommand, "BIOSPWD", DbType.String, this.BIOSPWD);
			db.AddInParameter(dbCommand, "WebPWD", DbType.String, this.WebPWD);
			db.AddInParameter(dbCommand, "IPAddr", DbType.String, this.IPAddr);
			db.AddInParameter(dbCommand, "SubnetMask", DbType.String, this.SubnetMask);
			db.AddInParameter(dbCommand, "DefaultGateway", DbType.String, this.DefaultGateway);
			db.AddInParameter(dbCommand, "DNS1", DbType.String, this.DNS1);
			db.AddInParameter(dbCommand, "DNS2", DbType.String, this.DNS2);
			db.AddInParameter(dbCommand, "MACAddr", DbType.String, this.MACAddr);
			if (this.WebNetIsOpen == null)
			{
			db.AddInParameter(dbCommand, "WebNetIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "WebNetIsOpen", DbType.Decimal, this.WebNetIsOpen.Value);
			}
			if (this.USBIsOpen == null)
			{
			db.AddInParameter(dbCommand, "USBIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "USBIsOpen", DbType.Decimal, this.USBIsOpen.Value);
			}
			if (this.QQIsOpen == null)
			{
			db.AddInParameter(dbCommand, "QQIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "QQIsOpen", DbType.Decimal, this.QQIsOpen.Value);
			}
			if (this.MsnIsOpen == null)
			{
			db.AddInParameter(dbCommand, "MsnIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "MsnIsOpen", DbType.Decimal, this.MsnIsOpen.Value);
			}
			db.AddInParameter(dbCommand, "Remark", DbType.String, this.Remark);
			if (this.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, this.CreateDate.Value);
			}
			if (this.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, this.CreateBy.Value);
			}
			if (this.ModifyDate == null)
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, this.ModifyDate.Value);
			}
			if (this.ModifyBy == null)
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, this.ModifyBy.Value);
			}

			
			return	db.ExecuteNonQuery(dbCommand);

		}
		



		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public override int Update(tbCustEmployeeInfoEntity entity)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update tb_CustEmployeeInfo set ");
			strSql.Append("[ID]=@ID,[CompanyID]=@CompanyID,[RealName]=@RealName,[Nickname]=@Nickname,[sex]=@sex,[DepartmentID]=@DepartmentID,[job]=@job,[State]=@State,[EmployeeNo]=@EmployeeNo,[Email]=@Email,[Tel]=@Tel,[Moblile]=@Moblile,[MSN]=@MSN,[QQ]=@QQ,[PCUserName]=@PCUserName,[PCPWD]=@PCPWD,[PCName]=@PCName,[WorkGroup]=@WorkGroup,[EmailName]=@EmailName,[EmailPWD]=@EmailPWD,[BIOSPWD]=@BIOSPWD,[WebPWD]=@WebPWD,[IPAddr]=@IPAddr,[SubnetMask]=@SubnetMask,[DefaultGateway]=@DefaultGateway,[DNS1]=@DNS1,[DNS2]=@DNS2,[MACAddr]=@MACAddr,[WebNetIsOpen]=@WebNetIsOpen,[USBIsOpen]=@USBIsOpen,[QQIsOpen]=@QQIsOpen,[MsnIsOpen]=@MsnIsOpen,[Remark]=@Remark,[CreateDate]=@CreateDate,[CreateBy]=@CreateBy,[ModifyDate]=@ModifyDate,[ModifyBy]=@ModifyBy ");

            strSql.Append(" where ID=@ID ");
            Database db = GetDatabase();
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "ID", DbType.Int32, entity.ID );
			if (entity.CompanyID == null)
			{
			db.AddInParameter(dbCommand, "CompanyID", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CompanyID", DbType.Int32, entity.CompanyID.Value);
			}
			db.AddInParameter(dbCommand, "RealName", DbType.String, entity.RealName);
			db.AddInParameter(dbCommand, "Nickname", DbType.String, entity.Nickname);
			db.AddInParameter(dbCommand, "sex", DbType.String, entity.sex);
			db.AddInParameter(dbCommand, "DepartmentID", DbType.String, entity.DepartmentID);
			db.AddInParameter(dbCommand, "job", DbType.String, entity.job);
			if (entity.State == null)
			{
			db.AddInParameter(dbCommand, "State", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "State", DbType.Int32, entity.State.Value);
			}
			db.AddInParameter(dbCommand, "EmployeeNo", DbType.String, entity.EmployeeNo);
			db.AddInParameter(dbCommand, "Email", DbType.String, entity.Email);
			db.AddInParameter(dbCommand, "Tel", DbType.String, entity.Tel);
			db.AddInParameter(dbCommand, "Moblile", DbType.String, entity.Moblile);
			db.AddInParameter(dbCommand, "MSN", DbType.String, entity.MSN);
			db.AddInParameter(dbCommand, "QQ", DbType.String, entity.QQ);
			db.AddInParameter(dbCommand, "PCUserName", DbType.String, entity.PCUserName);
			db.AddInParameter(dbCommand, "PCPWD", DbType.String, entity.PCPWD);
			db.AddInParameter(dbCommand, "PCName", DbType.String, entity.PCName);
			db.AddInParameter(dbCommand, "WorkGroup", DbType.String, entity.WorkGroup);
			db.AddInParameter(dbCommand, "EmailName", DbType.String, entity.EmailName);
			db.AddInParameter(dbCommand, "EmailPWD", DbType.String, entity.EmailPWD);
			db.AddInParameter(dbCommand, "BIOSPWD", DbType.String, entity.BIOSPWD);
			db.AddInParameter(dbCommand, "WebPWD", DbType.String, entity.WebPWD);
			db.AddInParameter(dbCommand, "IPAddr", DbType.String, entity.IPAddr);
			db.AddInParameter(dbCommand, "SubnetMask", DbType.String, entity.SubnetMask);
			db.AddInParameter(dbCommand, "DefaultGateway", DbType.String, entity.DefaultGateway);
			db.AddInParameter(dbCommand, "DNS1", DbType.String, entity.DNS1);
			db.AddInParameter(dbCommand, "DNS2", DbType.String, entity.DNS2);
			db.AddInParameter(dbCommand, "MACAddr", DbType.String, entity.MACAddr);
			if (entity.WebNetIsOpen == null)
			{
			db.AddInParameter(dbCommand, "WebNetIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "WebNetIsOpen", DbType.Decimal, entity.WebNetIsOpen.Value);
			}
			if (entity.USBIsOpen == null)
			{
			db.AddInParameter(dbCommand, "USBIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "USBIsOpen", DbType.Decimal, entity.USBIsOpen.Value);
			}
			if (entity.QQIsOpen == null)
			{
			db.AddInParameter(dbCommand, "QQIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "QQIsOpen", DbType.Decimal, entity.QQIsOpen.Value);
			}
			if (entity.MsnIsOpen == null)
			{
			db.AddInParameter(dbCommand, "MsnIsOpen", DbType.Decimal, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "MsnIsOpen", DbType.Decimal, entity.MsnIsOpen.Value);
			}
			db.AddInParameter(dbCommand, "Remark", DbType.String, entity.Remark);
			if (entity.CreateDate == null)
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateDate", DbType.DateTime, entity.CreateDate.Value);
			}
			if (entity.CreateBy == null)
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "CreateBy", DbType.Int32, entity.CreateBy.Value);
			}
			if (entity.ModifyDate == null)
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyDate", DbType.DateTime, entity.ModifyDate.Value);
			}
			if (entity.ModifyBy == null)
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, System.DBNull.Value);
			}
			else
			{
			db.AddInParameter(dbCommand, "ModifyBy", DbType.Int32, entity.ModifyBy.Value);
			}

			
			return	db.ExecuteNonQuery(dbCommand);

		}
		


		
		
		
		
		/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private tbCustEmployeeInfoEntity ReaderBind(IDataReader dataReader,int seq)
        {
            ITOMMS.Entity.tbCustEmployeeInfoEntity entity = new ITOMMS.Entity.tbCustEmployeeInfoEntity();
			entity.SEQNO = seq;
            object obj;
			obj = dataReader["ID"];
			 if (obj != null && obj != DBNull.Value)
			 {
			 entity.ID = (int)obj;
			 }
			 obj=dataReader["CompanyID"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CompanyID= (int)obj;
			}
			 entity.RealName= dataReader["RealName"].ToString();
			 entity.Nickname= dataReader["Nickname"].ToString();
			 entity.sex= dataReader["sex"].ToString();
			 entity.DepartmentID= dataReader["DepartmentID"].ToString();
			 entity.job= dataReader["job"].ToString();
			 obj=dataReader["State"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.State= (int)obj;
			}
			 entity.EmployeeNo= dataReader["EmployeeNo"].ToString();
			 entity.Email= dataReader["Email"].ToString();
			 entity.Tel= dataReader["Tel"].ToString();
			 entity.Moblile= dataReader["Moblile"].ToString();
			 entity.MSN= dataReader["MSN"].ToString();
			 entity.QQ= dataReader["QQ"].ToString();
			 entity.PCUserName= dataReader["PCUserName"].ToString();
			 entity.PCPWD= dataReader["PCPWD"].ToString();
			 entity.PCName= dataReader["PCName"].ToString();
			 entity.WorkGroup= dataReader["WorkGroup"].ToString();
			 entity.EmailName= dataReader["EmailName"].ToString();
			 entity.EmailPWD= dataReader["EmailPWD"].ToString();
			 entity.BIOSPWD= dataReader["BIOSPWD"].ToString();
			 entity.WebPWD= dataReader["WebPWD"].ToString();
			 entity.IPAddr= dataReader["IPAddr"].ToString();
			 entity.SubnetMask= dataReader["SubnetMask"].ToString();
			 entity.DefaultGateway= dataReader["DefaultGateway"].ToString();
			 entity.DNS1= dataReader["DNS1"].ToString();
			 entity.DNS2= dataReader["DNS2"].ToString();
			 entity.MACAddr= dataReader["MACAddr"].ToString();
			 obj=dataReader["WebNetIsOpen"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.WebNetIsOpen= (bool)obj;
			}
			 obj=dataReader["USBIsOpen"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.USBIsOpen= (bool)obj;
			}
			 obj=dataReader["QQIsOpen"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.QQIsOpen= (bool)obj;
			}
			 obj=dataReader["MsnIsOpen"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.MsnIsOpen= (bool)obj;
			}
			 entity.Remark= dataReader["Remark"].ToString();
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}
			 obj=dataReader["CreateBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateBy= (int)obj;
			}
			 obj=dataReader["ModifyDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyDate= (DateTime)obj;
			}
			 obj=dataReader["ModifyBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyBy= (int)obj;
			}

            return entity;
        }
		
		
				/// <summary>
        /// 对象实体绑定数据
		///生成构造为list的构造器
        /// </summary>
        private tbCustEmployeeInfoEntity ReaderBind(IDataReader dataReader)
        {
            ITOMMS.Entity.tbCustEmployeeInfoEntity entity = new ITOMMS.Entity.tbCustEmployeeInfoEntity();
			object obj;
			obj = dataReader["ID"];
			 if (obj != null && obj != DBNull.Value)
			 {
			 entity.ID = (int)obj;
			 }
			 obj=dataReader["CompanyID"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CompanyID= (int)obj;
			}
			 entity.RealName= dataReader["RealName"].ToString();
			 entity.Nickname= dataReader["Nickname"].ToString();
			 entity.sex= dataReader["sex"].ToString();
			 entity.DepartmentID= dataReader["DepartmentID"].ToString();
			 entity.job= dataReader["job"].ToString();
			 obj=dataReader["State"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.State= (int)obj;
			}
			 entity.EmployeeNo= dataReader["EmployeeNo"].ToString();
			 entity.Email= dataReader["Email"].ToString();
			 entity.Tel= dataReader["Tel"].ToString();
			 entity.Moblile= dataReader["Moblile"].ToString();
			 entity.MSN= dataReader["MSN"].ToString();
			 entity.QQ= dataReader["QQ"].ToString();
			 entity.PCUserName= dataReader["PCUserName"].ToString();
			 entity.PCPWD= dataReader["PCPWD"].ToString();
			 entity.PCName= dataReader["PCName"].ToString();
			 entity.WorkGroup= dataReader["WorkGroup"].ToString();
			 entity.EmailName= dataReader["EmailName"].ToString();
			 entity.EmailPWD= dataReader["EmailPWD"].ToString();
			 entity.BIOSPWD= dataReader["BIOSPWD"].ToString();
			 entity.WebPWD= dataReader["WebPWD"].ToString();
			 entity.IPAddr= dataReader["IPAddr"].ToString();
			 entity.SubnetMask= dataReader["SubnetMask"].ToString();
			 entity.DefaultGateway= dataReader["DefaultGateway"].ToString();
			 entity.DNS1= dataReader["DNS1"].ToString();
			 entity.DNS2= dataReader["DNS2"].ToString();
			 entity.MACAddr= dataReader["MACAddr"].ToString();
			 obj=dataReader["WebNetIsOpen"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.WebNetIsOpen= (bool)obj;
			}
			 obj=dataReader["USBIsOpen"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.USBIsOpen= (bool)obj;
			}
			 obj=dataReader["QQIsOpen"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.QQIsOpen= (bool)obj;
			}
			 obj=dataReader["MsnIsOpen"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.MsnIsOpen= (bool)obj;
			}
			 entity.Remark= dataReader["Remark"].ToString();
			 obj=dataReader["CreateDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateDate= (DateTime)obj;
			}
			 obj=dataReader["CreateBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.CreateBy= (int)obj;
			}
			 obj=dataReader["ModifyDate"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyDate= (DateTime)obj;
			}
			 obj=dataReader["ModifyBy"];
			if(obj != null && obj != DBNull.Value)
			{
			 entity.ModifyBy= (int)obj;
			}

            return entity;
        }
		
		
		
		 #endregion
		
	}
}
